home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / ISSUE20 / CLINIC / Directio / POKEPROC.C < prev    next >
Encoding:
C/C++ Source or Header  |  1995-09-12  |  652 b   |  20 lines

  1. /*
  2.  *  From inpection of the TSS we know that NT's default IOPM offset is
  3.  * 0x20AD.  From an inspection of a dump of a process structure, we
  4.  * can find the bytes 'AD 20' at offset 0x30.  This is where NT stores
  5.  * the IOPM offset for each process, so that I/O access can be granted
  6.  * on a process-by-process basis.  This portion of the process
  7.  * structure is not documented in the DDK.
  8.  *
  9.  *  This kernel mode driver fragment illustrates the brute force
  10.  * method of poking the IOPM base into the process structure.
  11.  */
  12. void GiveIO()
  13. {
  14.     char *CurProc;
  15.  
  16.     CurProc = IoGetCurrentProcess();
  17.     *((USHORT *)(CurProc + 0x30)) = 0x88;
  18. }
  19.  
  20.